<template>
    <div class="store-nearby">
        <div class="single" v-for="(item, key) in nearList" :key="key">
            <svg class="icon selected"
                 aria-hidden="true"
                 :class="storeState.indexOf(item.id)>=0? 'choose' : 'no-choose' "
                 @click="chooseOne(item)"
            >
                <use xlink:href="#icon-selected"></use>
            </svg>
        </div>
    </div>
</template>

<script>
    export default {
        name: "store-nearby",
        props: {
            nearList:{
                type: Array
            }
        },
        data(){
            return{
                choosedId: [], // 被选中自提点id
            }
        },
        computed:{
            storeState() { // 商品是否选中状态
                return this.choosedId
            },
        },
        methods:{
            // 单独选择
            chooseOne (item) {

            },
        },
    }
</script>

<style lang='stylus' rel='stylesheet/stylus' scoped>
    @import '~@/assets/main.styl'
    .single{
        width vw(375)
        height vw(80)
        background-color grayF
        border-top vw(1) solid grayE
        /*border 1px solid aqua*/
    }
    .selected {
        position absolute
        left smallMargin
        width vw(20)
        height vw(20)
    }
    .no-choose {
        fill grayE
    }
    .choose {
        fill main-color
    }

</style>